Skip to content

feat(panel): add hide-reviewed-files mode - #309

Merged
dlyongemallo merged 9 commits into
dlyongemallo:mainfrom
florentcigolotti:feature/hide-reviewed-files
Aug 24, 2026
Merged

feat(panel): add hide-reviewed-files mode#309
dlyongemallo merged 9 commits into
dlyongemallo:mainfrom
florentcigolotti:feature/hide-reviewed-files

Conversation

@florentcigolotti

Copy link
Copy Markdown

Florent Cigolotti added 6 commits August 20, 2026 19:32
Allow reviewed files, represented by panel selections, to be hidden so reviewers can focus on the remaining files.

Expose toggle_hide_selected with H as the default mapping, filter list and tree views, update section counts, show a hidden-files hint, and adjust navigation when entries disappear from the panel.
Store the hide-reviewed flag alongside file selections in the same repository and revision scope.

Restore the flag when opening or retargeting a view, save toggle changes immediately, and treat stores without the field as hide mode disabled.
Cover hide-state serialization, backward-compatible store entries,
visible and hidden counts, list filtering, and keymap overrides.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

It is a sizable feature that reworks core file-panel navigation, rendering, and persistence with many interactive edge cases best validated by a human, and only minor nits were found.

Pull request overview

This PR implements the "hide reviewed files" feature requested in issue #307. Building on the existing multi-file selection ("mark reviewed") system, it adds an H mapping and a toggle_hide_selected action that hide/reveal marked (reviewed) files in the diff file panel, letting users focus on the remaining changes. Section counters switch to a visible/total form while hiding is active, a footer hint reports how many files are hidden, and the hide state is persisted per repository/revision alongside the existing selection persistence. Navigation is carefully updated so the diff never lingers on a file that just disappeared.

Changes:

  • New FilePanel state hide_selected with helpers (toggle_hide_selected, count_hidden, count_visible) and filtering in ordered_file_list/reconstrain_cursor.
  • Renderer skips hidden files/empty directories, shows visible/total counters, and renders a "N reviewed file(s) hidden" footer; listeners rewrite the toggle flow with find_visible_neighbor to keep the shown diff and cursor coherent.
  • Persistence extended to round-trip the hide flag (selection_store + diff_view), plus new keymap/action registration, docs, and extensive tests.
File summaries
File Description
lua/diffview/scene/views/diff/file_panel.lua Adds hide_selected state, filtering in ordered_file_list, and toggle_hide_selected/count_hidden/count_visible; cursor reconstraint when no rows are visible.
lua/diffview/scene/views/diff/render.lua Skips hidden files/dirs, renders visible/total section counters, and adds the hidden-files footer hint.
lua/diffview/scene/views/diff/listeners.lua Rewrites toggle_select_entry and adds toggle_hide_selected with neighbor-finding navigation.
lua/diffview/scene/views/diff/diff_view.lua Loads/saves the hide flag with selections, including across revision-scope changes.
lua/diffview/selection_store.lua Persists and loads the hide flag; keeps scope when hiding with no selections.
lua/diffview/config.lua Registers the H keymap and updates persist_selections docs.
lua/diffview/actions.lua Declares and exposes the toggle_hide_selected action.
doc/diffview.txt, doc/diffview_defaults.txt, README.md Document the new mapping, action, and persistence behavior.
lua/diffview/tests/functional/*.lua Adds tests for store round-trip, panel filtering/counters, navigation, config keymap, and API refresh.
Review details
  • Files reviewed: 16/16 changed files
  • Comments generated: 2
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +461 to +463
local vis_c, tot_c = panel:count_visible("conflicting")
local count_c = (panel.hide_selected and vis_c < tot_c) and (vis_c .. "/" .. tot_c)
or tostring(tot_c)
eq(1, tot_s)
end)

it("count_visible returns 0,0 for an unknown kind", function()
Comment thread lua/diffview/scene/views/diff/file_panel.lua
@dlyongemallo dlyongemallo changed the title Feature/hide reviewed files feat(panel): add hide-reviewed-files mode Aug 24, 2026
@dlyongemallo
dlyongemallo merged commit 30afab6 into dlyongemallo:main Aug 24, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants